<?php

/**
 * Input4wksForecast filter form base class.
 *
 * @package    TMD
 * @subpackage filter
 * @author     Thaihosting
 */
abstract class BaseInput4wksForecastFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'DTSAVE_TIME'          => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'IUSER_ID'             => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'ITEMP_MAX_LOWBOUND'   => new sfWidgetFormFilterInput(),
      'ITEMP_MAX_HIGHBOUND'  => new sfWidgetFormFilterInput(),
      'ITEMP_MIN_LOWBOUND'   => new sfWidgetFormFilterInput(),
      'ITEMP_MIN_HIGHBOUND'  => new sfWidgetFormFilterInput(),
      'IRAINFALL_LOWBOUND'   => new sfWidgetFormFilterInput(),
      'IRAINFALL_HIGHBOUND'  => new sfWidgetFormFilterInput(),
      'SDESC_TH'             => new sfWidgetFormFilterInput(),
      'SDESC_ENG'            => new sfWidgetFormFilterInput(),
      'SWARNING_TH'          => new sfWidgetFormFilterInput(),
      'SWARNING_ENG'         => new sfWidgetFormFilterInput(),
      'IWEATHER_TYPE'        => new sfWidgetFormFilterInput(),
      'ITEMPERATURE_TYPE'    => new sfWidgetFormFilterInput(),
      'IWAVE_TYPE'           => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'DTSAVE_TIME'          => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'IUSER_ID'             => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'ITEMP_MAX_LOWBOUND'   => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'ITEMP_MAX_HIGHBOUND'  => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'ITEMP_MIN_LOWBOUND'   => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'ITEMP_MIN_HIGHBOUND'  => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'IRAINFALL_LOWBOUND'   => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'IRAINFALL_HIGHBOUND'  => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'SDESC_TH'             => new sfValidatorPass(array('required' => false)),
      'SDESC_ENG'            => new sfValidatorPass(array('required' => false)),
      'SWARNING_TH'          => new sfValidatorPass(array('required' => false)),
      'SWARNING_ENG'         => new sfValidatorPass(array('required' => false)),
      'IWEATHER_TYPE'        => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'ITEMPERATURE_TYPE'    => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'IWAVE_TYPE'           => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
    ));

    $this->widgetSchema->setNameFormat('input4wks_forecast_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Input4wksForecast';
  }

  public function getFields()
  {
    return array(
      'DTTIME_FORECAST_FROM' => 'Date',
      'DTTIME_FORECAST_TO'   => 'Date',
      'IGEOGRAPHIC_REGION'   => 'Number',
      'DTSAVE_TIME'          => 'Date',
      'IUSER_ID'             => 'Number',
      'ITEMP_MAX_LOWBOUND'   => 'Number',
      'ITEMP_MAX_HIGHBOUND'  => 'Number',
      'ITEMP_MIN_LOWBOUND'   => 'Number',
      'ITEMP_MIN_HIGHBOUND'  => 'Number',
      'IRAINFALL_LOWBOUND'   => 'Number',
      'IRAINFALL_HIGHBOUND'  => 'Number',
      'SDESC_TH'             => 'Text',
      'SDESC_ENG'            => 'Text',
      'SWARNING_TH'          => 'Text',
      'SWARNING_ENG'         => 'Text',
      'IWEATHER_TYPE'        => 'Number',
      'ITEMPERATURE_TYPE'    => 'Number',
      'IWAVE_TYPE'           => 'Number',
    );
  }
}
